package com.sinosoft.hydra.um.domain.permission;

import com.alibaba.fastjson.annotation.JSONField;
import org.hibernate.annotations.GenericGenerator;
import org.hibernate.annotations.NotFound;
import org.hibernate.annotations.NotFoundAction;

import javax.persistence.*;
import javax.validation.constraints.Max;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import java.io.Serializable;
import java.util.Date;
import java.util.List;

@Entity
@Table(name="T_MESSAGE")
public class TMessage implements Serializable {
    /**
     * This field was generated by MyBatis Generator.
     * This field corresponds to the database column T_MESSAGE.ID
     *
     * @mbggenerated Mon Aug 31 12:12:57 CST 2015
     */

    @Id
    @GeneratedValue(generator = "system-uuid")
    @GenericGenerator(name = "system-uuid", strategy = "uuid")
    @Column(name="ID")
    private String id;

    /**
     * This field was generated by MyBatis Generator.
     * This field corresponds to the database column T_MESSAGE.FROM_ID
     *
     * @mbggenerated Mon Aug 31 12:12:57 CST 2015
     */

    @OneToOne(cascade = CascadeType.DETACH)
    @JoinColumn(name="FROM_ID")
    @NotFound(action = NotFoundAction.IGNORE)
    private SysUserMember fromUser;

    /**
     * This field was generated by MyBatis Generator.
     * This field corresponds to the database column T_MESSAGE.SEND_TIME
     *
     * @mbggenerated Mon Aug 31 12:12:57 CST 2015
     */
    @Column(name="SEND_TIME")
    @JSONField(format = "yyyy-MM-dd HH:mm:ss")
    private Date sendTime;

    /**
     * This field was generated by MyBatis Generator.
     * This field corresponds to the database column T_MESSAGE.SENDED_TIME
     *
     * @mbggenerated Mon Aug 31 12:12:57 CST 2015
     */
    @Column(name="SENDED_TIME")
    @JSONField(format = "yyyy-MM-dd HH:mm:ss")
    private Date sendedTime;

    /**
     * This field was generated by MyBatis Generator.
     * This field corresponds to the database column T_MESSAGE.SEND_STATUS
     *
     * @mbggenerated Mon Aug 31 12:12:57 CST 2015
     */

    @Column(name="SEND_STATUS")
    private String sendStatus;

    /**
     * This field was generated by MyBatis Generator.
     * This field corresponds to the database column T_MESSAGE.SEND_CONTENT
     *
     * @mbggenerated Mon Aug 31 12:12:57 CST 2015
     */

    @Column(name="SEND_CONTENT")
    private String sendContent;

    /**
     * This field was generated by MyBatis Generator.
     * This field corresponds to the database column T_MESSAGE.MESSAGE_TYPE
     *
     * @mbggenerated Mon Aug 31 12:12:57 CST 2015
     */

    @Column(name="MESSAGE_TYPE")
    private String messageType;

    /**
     * This field was generated by MyBatis Generator.
     * This field corresponds to the database column T_MESSAGE.SENDER_NAME
     *
     * @mbggenerated Mon Aug 31 12:12:57 CST 2015
     */

    @Column(name="SENDER_NAME")
    private String senderName;

    /**
     * This field was generated by MyBatis Generator.
     * This field corresponds to the database column T_MESSAGE.CREATE_TIME
     *
     * @mbggenerated Mon Aug 31 12:12:57 CST 2015
     */
    @Column(name="CREATE_TIME")
    @JSONField(format = "yyyy-MM-dd HH:mm:ss")
    private Date createTime;

    /**
     * This field was generated by MyBatis Generator.
     * This field corresponds to the database column T_MESSAGE.SEND_TITLE
     *
     * @mbggenerated Mon Aug 31 12:12:57 CST 2015
     */

    @Column(name="SEND_TITLE")
    private String sendTitle;

    /**
     * This field was generated by MyBatis Generator.
     * This field corresponds to the database table T_MESSAGE
     *
     * @mbggenerated Mon Aug 31 12:12:57 CST 2015
     */
    private static final long serialVersionUID = 1L;

    /**
     * This field was generated by MyBatis Generator.
     * This field corresponds to the database column T_MESSAGE_RECEIVER.MESSAGE_ID
     *
     * @mbggenerated Mon Aug 31 12:12:57 CST 2015
     */
    @OneToMany
    @JoinColumn(name="MESSAGE_ID")
    @JSONField(serialize = false)
    private List<TMessageReceiver> tMessageReceivers;

    /**
     * This method was generated by MyBatis Generator.
     * This method returns the value of the database column T_MESSAGE.ID
     *
     * @return the value of T_MESSAGE.ID
     *
     * @mbggenerated Mon Aug 31 12:12:57 CST 2015
     */
    public String getId() {
        return id;
    }

    /**
     * This method was generated by MyBatis Generator.
     * This method sets the value of the database column T_MESSAGE.ID
     *
     * @param id the value for T_MESSAGE.ID
     *
     * @mbggenerated Mon Aug 31 12:12:57 CST 2015
     */
    public void setId(String id) {
        this.id = id == null ? null : id.trim();
    }

    /**
     * This method was generated by MyBatis Generator.
     * This method returns the value of the database column T_MESSAGE.FROM_ID
     *
     * @return the value of T_MESSAGE.FROM_ID
     *
     * @mbggenerated Mon Aug 31 12:12:57 CST 2015
     */
    public SysUserMember getFromUser() {
        return fromUser;
    }

    /**
     * This method was generated by MyBatis Generator.
     * This method sets the value of the database column T_MESSAGE.FROM_ID
     *
     * @param fromUser the value for T_MESSAGE.FROM_ID
     *
     * @mbggenerated Mon Aug 31 12:12:57 CST 2015
     */
    public void setFromUser(SysUserMember fromUser) {
        this.fromUser = fromUser;
    }

    /**
     * This method was generated by MyBatis Generator.
     * This method returns the value of the database column T_MESSAGE.SEND_TIME
     *
     * @return the value of T_MESSAGE.SEND_TIME
     *
     * @mbggenerated Mon Aug 31 12:12:57 CST 2015
     */
    public Date getSendTime() {
        return sendTime;
    }

    /**
     * This method was generated by MyBatis Generator.
     * This method sets the value of the database column T_MESSAGE.SEND_TIME
     *
     * @param sendTime the value for T_MESSAGE.SEND_TIME
     *
     * @mbggenerated Mon Aug 31 12:12:57 CST 2015
     */
    public void setSendTime(Date sendTime) {
        this.sendTime = sendTime;
    }

    /**
     * This method was generated by MyBatis Generator.
     * This method returns the value of the database column T_MESSAGE.SENDED_TIME
     *
     * @return the value of T_MESSAGE.SENDED_TIME
     *
     * @mbggenerated Mon Aug 31 12:12:57 CST 2015
     */
    public Date getSendedTime() {
        return sendedTime;
    }

    /**
     * This method was generated by MyBatis Generator.
     * This method sets the value of the database column T_MESSAGE.SENDED_TIME
     *
     * @param sendedTime the value for T_MESSAGE.SENDED_TIME
     *
     * @mbggenerated Mon Aug 31 12:12:57 CST 2015
     */
    public void setSendedTime(Date sendedTime) {
        this.sendedTime = sendedTime;
    }

    /**
     * This method was generated by MyBatis Generator.
     * This method returns the value of the database column T_MESSAGE.SEND_STATUS
     *
     * @return the value of T_MESSAGE.SEND_STATUS
     *
     * @mbggenerated Mon Aug 31 12:12:57 CST 2015
     */
    public String getSendStatus() {
        return sendStatus;
    }

    /**
     * This method was generated by MyBatis Generator.
     * This method sets the value of the database column T_MESSAGE.SEND_STATUS
     *
     * @param sendStatus the value for T_MESSAGE.SEND_STATUS
     *
     * @mbggenerated Mon Aug 31 12:12:57 CST 2015
     */
    public void setSendStatus(String sendStatus) {
        this.sendStatus = sendStatus == null ? null : sendStatus.trim();
    }

    /**
     * This method was generated by MyBatis Generator.
     * This method returns the value of the database column T_MESSAGE.SEND_CONTENT
     *
     * @return the value of T_MESSAGE.SEND_CONTENT
     *
     * @mbggenerated Mon Aug 31 12:12:57 CST 2015
     */
    public String getSendContent() {
        return sendContent;
    }

    /**
     * This method was generated by MyBatis Generator.
     * This method sets the value of the database column T_MESSAGE.SEND_CONTENT
     *
     * @param sendContent the value for T_MESSAGE.SEND_CONTENT
     *
     * @mbggenerated Mon Aug 31 12:12:57 CST 2015
     */
    public void setSendContent(String sendContent) {
        this.sendContent = sendContent == null ? null : sendContent.trim();
    }

    /**
     * This method was generated by MyBatis Generator.
     * This method returns the value of the database column T_MESSAGE.MESSAGE_TYPE
     *
     * @return the value of T_MESSAGE.MESSAGE_TYPE
     *
     * @mbggenerated Mon Aug 31 12:12:57 CST 2015
     */
    public String getMessageType() {
        return messageType;
    }

    /**
     * This method was generated by MyBatis Generator.
     * This method sets the value of the database column T_MESSAGE.MESSAGE_TYPE
     *
     * @param messageType the value for T_MESSAGE.MESSAGE_TYPE
     *
     * @mbggenerated Mon Aug 31 12:12:57 CST 2015
     */
    public void setMessageType(String messageType) {
        this.messageType = messageType == null ? null : messageType.trim();
    }



    /**
     * This method was generated by MyBatis Generator.
     * This method returns the value of the database column T_MESSAGE.SENDER_NAME
     *
     * @return the value of T_MESSAGE.SENDER_NAME
     *
     * @mbggenerated Mon Aug 31 12:12:57 CST 2015
     */
    public String getSenderName() {
        return senderName;
    }

    /**
     * This method was generated by MyBatis Generator.
     * This method sets the value of the database column T_MESSAGE.SENDER_NAME
     *
     * @param senderName the value for T_MESSAGE.SENDER_NAME
     *
     * @mbggenerated Mon Aug 31 12:12:57 CST 2015
     */
    public void setSenderName(String senderName) {
        this.senderName = senderName == null ? null : senderName.trim();
    }

    /**
     * This method was generated by MyBatis Generator.
     * This method returns the value of the database column T_MESSAGE.CREATE_TIME
     *
     * @return the value of T_MESSAGE.CREATE_TIME
     *
     * @mbggenerated Mon Aug 31 12:12:57 CST 2015
     */
    public Date getCreateTime() {
        return createTime;
    }

    /**
     * This method was generated by MyBatis Generator.
     * This method sets the value of the database column T_MESSAGE.CREATE_TIME
     *
     * @param createTime the value for T_MESSAGE.CREATE_TIME
     *
     * @mbggenerated Mon Aug 31 12:12:57 CST 2015
     */
    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }

    /**
     * This method was generated by MyBatis Generator.
     * This method returns the value of the database column T_MESSAGE.SEND_TITLE
     *
     * @return the value of T_MESSAGE.SEND_TITLE
     *
     * @mbggenerated Mon Aug 31 12:12:57 CST 2015
     */
    public String getSendTitle() {
        return sendTitle;
    }

    /**
     * This method was generated by MyBatis Generator.
     * This method sets the value of the database column T_MESSAGE.SEND_TITLE
     *
     * @param sendTitle the value for T_MESSAGE.SEND_TITLE
     *
     * @mbggenerated Mon Aug 31 12:12:57 CST 2015
     */
    public void setSendTitle(String sendTitle) {
        this.sendTitle = sendTitle == null ? null : sendTitle.trim();
    }

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table T_MESSAGE
     *
     * @mbggenerated Mon Aug 31 12:12:57 CST 2015
     */

    public String toString() {
        StringBuilder sb = new StringBuilder();
        sb.append(getClass().getSimpleName());
        sb.append(" [");
        sb.append("Hash = ").append(hashCode());
        sb.append(", id=").append(id);
        sb.append(", fromUser=").append(fromUser);
        sb.append(", sendTime=").append(sendTime);
        sb.append(", sendedTime=").append(sendedTime);
        sb.append(", sendStatus=").append(sendStatus);
        sb.append(", sendContent=").append(sendContent);
        sb.append(", messageType=").append(messageType);
        sb.append(", senderName=").append(senderName);
        sb.append(", createTime=").append(createTime);
        sb.append(", sendTitle=").append(sendTitle);
        sb.append("]");
        return sb.toString();
    }

    /**
     * This method was generated by MyBatis Generator.
     * This method returns the value of the database column T_MESSAGE_RECEIVER.MESSAGE_ID
     *
     * @return the value of T_MESSAGE_RECEIVER.MESSAGE_ID
     *
     * @mbggenerated Mon Aug 31 12:12:57 CST 2015
     */
    public List<TMessageReceiver> gettMessageReceivers() {
        return tMessageReceivers;
    }

    /**
     * This method was generated by MyBatis Generator.
     * This method sets the value of the database column T_MESSAGE_RECEIVER.MESSAGE_ID
     *
     * @param tMessageReceivers the value for T_MESSAGE_RECEIVER.MESSAGE_ID
     *
     * @mbggenerated Mon Aug 31 12:12:57 CST 2015
     */
    public void settMessageReceivers(List<TMessageReceiver> tMessageReceivers) {
        this.tMessageReceivers = tMessageReceivers;
    }
}